package com.czy.owner.api;

import com.czy.owner.db.UserHelper;
import com.czy.owner.global.Constants;
import com.czy.owner.net.api.BaseApi;
import com.czy.owner.net.listener.HttpOnNextListener;
import com.trello.rxlifecycle.components.support.RxAppCompatActivity;

import retrofit2.Retrofit;
import rx.Observable;

/**
 * Created by wangyang on 2017/5/10 0010.
 */

public class EditUserLocationApi extends BaseApi {
    private String session;
    private String userLocationId;

    public EditUserLocationApi(HttpOnNextListener listener, RxAppCompatActivity rxAppCompatActivity) {
        super(listener, rxAppCompatActivity);
        setShowProgress(true);
        setCache(true);
        setMothed(UserHelper.getInstance().getUserAccount()+Constants.OWN_SHOP_EDITUSERLOCATION);//相当于缓存保存的Key
        setCookieNetWorkTime(24 * 60 * 60 * 7);//有网缓存7天,在7天内点击无效
        setConnectionTime(15);//超时时间
        setCookieNoNetWorkTime(24 * 60 * 60 * 30);//无网缓存30天

    }

    public String getSession() {
        return session;
    }

    public void setSession(String session) {
        this.session = session;
    }

    public String getUserLocationId() {
        return userLocationId;
    }

    public void setUserLocationId(String userLocationId) {
        this.userLocationId = userLocationId;
    }

    @Override
    public Observable getObservable(Retrofit retrofit) {
        HttpPostService service = retrofit.create(HttpPostService.class);
        return service.getEditUserLocationApi(getSession(),getUserLocationId());
    }


}
